package org.yacon;

import java.util.*;

/**
 * @author Evgeny Vetrov
 */
class Program {
    private final ConsoleCommand initCommand;
    private final ConsoleCommand destroyCommand;
    private final Map<String, ConsoleCommand> commandsMap;
    private final Set<String> names;
    private final String description;
    private final CommandHandler pipe;

    Program(Map<String, ConsoleCommand> commandsMap, ConsoleCommand initCommand, ConsoleCommand destroyCommand,
            Set<String> names, String description, CommandHandler pipe) {
        this.pipe = pipe;
        if (destroyCommand == null)
            throw new IllegalArgumentException("destroyCommand can't be null");
        this.destroyCommand = destroyCommand;
        this.initCommand = initCommand;
        this.description = description;
        this.names = Collections.unmodifiableSet(new HashSet<String>(names));
        this.commandsMap = Collections.unmodifiableMap(new HashMap<String, ConsoleCommand>(commandsMap));
    }

    ConsoleCommand getInitCommand() {
        return initCommand;
    }

    ConsoleCommand getDestroyCommand() {
        return destroyCommand;
    }

    Map<String, ConsoleCommand> getCommandsMap() {
        return commandsMap;
    }

    Set<String> getNames() {
        return names;
    }

    String getDescription() {
        return description;
    }

    CommandHandler getPipe() {
        return pipe;
    }
}